home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / libnixV1_0.lha / gnu / libnix-sources.lha / sources / headers / strsup.h < prev   
C/C++ Source or Header  |  1995-01-22  |  715b  |  51 lines

  1. #ifndef _STRSUP_H /* don't include this twice */
  2.  
  3. #define _STRSUP_H
  4.  
  5. #if defined(__GNUC__) && defined(__OPTIMIZE__)
  6.  
  7. extern __inline char *strcat(char *s1,const char *s2)
  8.   char *s=s1;
  9.  
  10.   while(*s++)
  11.     ;
  12.   --s;
  13.   while((*s++=*s2++))
  14.     ;
  15.   return s1;
  16. }
  17.  
  18. extern __inline char *strcpy(char *s1,const char *s2)
  19. { char *s=s1;
  20.   do
  21.     *s++=*s2;
  22.   while(*s2++!='\0');
  23.   return s1;
  24. }
  25.  
  26. extern __inline size_t strlen(const char *string)
  27. {
  28.   const char *s=string;
  29.  
  30.   while(*s++)
  31.     ;
  32.   return ~(string-s);
  33. }
  34.  
  35. extern __inline size_t strlen_plus_one(const char *string)
  36. {
  37.   const char *s=string;
  38.  
  39.   while(*s++)
  40.     ;
  41.   return (s-string);
  42. }
  43.  
  44. #else
  45.  
  46. #define strlen_plus_one(s) strlen(s)+1 /* not gnu :( */
  47.  
  48. #endif
  49. #endif
  50.